<html>
<head><meta charset="utf-8"><title>statics and BSS · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/statics.20and.20BSS.html">statics and BSS</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="168220871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/statics%20and%20BSS/near/168220871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/statics.20and.20BSS.html#168220871">(Jun 15 2019 at 19:48)</a>:</h4>
<p>If I declare a mutable static:</p>
<div class="codehilite"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">TX_WAKER</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="n">Waker</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">None</span><span class="p">;</span><span class="w"></span>
</pre></div>


<p>This seems to be placed in BSS:</p>
<div class="codehilite"><pre><span></span>00800221 l     O .bss   00000004 _ZN5blink3fut8TX_WAKER17h8714705085b6d300E
</pre></div>


<p>I assume that means it needs to be zeroed out when I load in myself in AVR land?</p>



<a name="168227664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/statics%20and%20BSS/near/168227664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/statics.20and.20BSS.html#168227664">(Jun 15 2019 at 23:46)</a>:</h4>
<p>Yes, it is usually the responsibility of the code itself to zero out the <code>.bss</code> section in embedded land</p>



<a name="168227666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/statics%20and%20BSS/near/168227666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/statics.20and.20BSS.html#168227666">(Jun 15 2019 at 23:46)</a>:</h4>
<p>It is often done by whatever thin supporting libraries you may have – the ARM thumb implements this code in their device libraries, for example</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>